package com.doublefish.doublefishrobot.ui.video.adapter;

import android.content.Context;
import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.viewholder.BaseViewHolder;
import com.doublefish.doublefishrobot.R;
import com.doublefish.doublefishrobot.ui.video.bean.VideoInfoBean;

import java.util.List;

/**
 * 作者:dugaofeng on 2024/10/31 09:46
 */
public class ClearVideoAdapter extends BaseQuickAdapter<ClearVideoAdapter.ClearVideoBean, ClearVideoAdapter.ClearVideoViewHolder> {

    private Context mContext;

    public ClearVideoAdapter(Context context, List<ClearVideoBean> data) {
        super(R.layout.item_clear_video_select, data);
        mContext = context;
    }

    @Override
    protected void convert(ClearVideoAdapter.ClearVideoViewHolder helper, ClearVideoBean item) {
        helper.nameTv.setText(item.getVideoInfoBean().getName());
        helper.sizeTv.setText(item.getVideoInfoBean().fileSizeText());

        helper.imageView.setSelected(item.isDidSelect());
    }

    class ClearVideoViewHolder extends BaseViewHolder {
        TextView nameTv;
        TextView sizeTv;
        ImageView imageView;

        public ClearVideoViewHolder(View view) {
            super(view);

            nameTv = view.findViewById(R.id.tv_name);
            sizeTv = view.findViewById(R.id.tv_size);
            imageView = view.findViewById(R.id.iv_select);
        }
    }

    public static class ClearVideoBean {
        boolean isDidSelect;
        VideoInfoBean videoInfoBean;

        public boolean isDidSelect() {
            return isDidSelect;
        }

        public void setDidSelect(boolean didSelect) {
            isDidSelect = didSelect;
        }

        public VideoInfoBean getVideoInfoBean() {
            return videoInfoBean;
        }

        public void setVideoInfoBean(VideoInfoBean videoInfoBean) {
            this.videoInfoBean = videoInfoBean;
        }
    }

}
